package de.tuhh.simsearch.dto;

import java.io.Serializable;
import java.math.BigInteger;
import java.util.HashSet;
import java.util.Set;

import javax.xml.bind.annotation.XmlRootElement;

/**
 * The FileDTO is the data transfer object for a file entity. The dto contains the file id, the displayed filename, the
 * content type, the owner, the description and the associated categories. If the file is not already in the database,
 * the id is null. It will be created in the backend.
 * 
 * @author SimSearch 1
 * 
 */
@XmlRootElement(name = "file")
public class FileDTO implements Serializable {

  /**
	 * 
	 */
  private static final long serialVersionUID = 5327384037928894121L;

  // private String path;

  private BigInteger id;

  private String displayedFilename;

  private String contentType;

  private String owner;

  private Set<String> categories = new HashSet<String>();

  private String description;

  protected FileDTO() {

  }

  /**
   * The class constructor which sets the file id
   * 
   * @param id
   *          the file id
   */
  public FileDTO(BigInteger id) {

    this.id = id;
  }

  /**
   * Gets the displayed filename
   * 
   * @return the displayed filename
   */
  public String getDisplayedFilename() {

    return displayedFilename;
  }

  /**
   * Gets the file id
   * 
   * @return the file id
   */
  public BigInteger getId() {

    return id;
  }

  /**
   * Sets the file id
   * 
   * @param id
   *          the id
   */
  public void setId(BigInteger id) {

    this.id = id;
  }

  /**
   * Sets the displayed filename
   * 
   * @param filename
   *          the filename
   */
  public void setDisplayedFilename(String filename) {

    this.displayedFilename = filename;
  }

  /**
   * Gets the content type
   * 
   * @return the string representation of the content type
   */
  public String getContentType() {

    return contentType;
  }

  /**
   * Sets the content type
   * 
   * @param contentType
   *          the string representation of the content type
   */
  public void setContentType(String contentType) {

    this.contentType = contentType;
  }

  /**
   * Gets the file owner
   * 
   * @return the name of the file owner
   */
  public String getOwner() {

    return owner;
  }

  /**
   * Sets the file owner
   * 
   * @param owner
   *          the name of the owner to be set
   */
  public void setOwner(String owner) {

    this.owner = owner;
  }

  /**
   * Gets the categories associated with this file
   * 
   * @return the set of categories' names
   */
  public Set<String> getCategories() {

    return categories;
  }

  /**
   * Sets the category set
   * 
   * @param categories
   *          the set to be set as new category set
   */
  public void setCategories(Set<String> categories) {

    this.categories = categories;
  }

  /**
   * Gets the description of the file
   * 
   * @return the file description
   */
  public String getDescription() {

    return description;
  }

  /**
   * Sets the description of the file
   * 
   * @param description
   *          the file description
   */
  public void setDescription(String description) {

    this.description = description;
  }

}
